<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"
  />
  <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  <title>登录</title>
  <link rel="stylesheet" type="text/css" href="../css/api.css" />
  <style>
    header {
      width: 100%;
      height: 50px;
      background-color: #f60
    }

    header .back {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 80px;
      height: 50px;
      background: url(../image/back.png);
      background-position: 12px 16px;
      background-size: 11px 18px;
      background-repeat: no-repeat;
    }

    header h1 {
      width: 100%;
      height: 50px;
      line-height: 50px;
      text-align: center;
      color: #fff;
      font-size: 20px;
    }

    header .right {
      position: absolute;
      bottom: 0;
      right: 0;
      width: 50px;
      height: 50px;
      line-height: 50px;
      color: #fff;
      font-size: 15px;
      text-align: center;
    }
  </style>
</head>

<body>
  <header id="header">
    <div class="back" tapmode onclick="api.closeWin();"></div>
    <h1>会员登录</h1>
    <div class="right" tapmode onclick="fnOpenRegisterWin();">注册</div>
  </header>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
  apiready = function () {
    var header = $api.byId('header');
    // $api.fixStatusBar(header);
    var headerH = $api.offset(header).h;
    console.log(headerH);

    // 打开注册Frame
    api.openFrame({
      name: 'login_frame',
      url: './login_frame.html',
      rect: {
        x: 0,
        y: headerH,
        w: 'auto',
        h: 'auto'
      },
      pageParam: {
        name: 'test'
      },
      bounces: false,
      softInputBarEnabled: false //不显示键盘上方的工具条
    });
  };

  function fnOpenRegisterWin() {
    api.alert({
      title: '',
      msg: '开发中'
    })
  }

  // // 打开注册Window
  // function fnOpenRegisterWin() {
  //   api.openWin({
  //     name: 'register',
  //     url: './register.html',
  //     pageParam: {
  //       name: 'test'
  //     }
  //   });
  // }
</script>

</html>